﻿using System;
using System.Collections.Generic;
using System.Text;

namespace WikiDoc
{
    /// <summary>
    /// a indent line
    /// </summary>
    public class IndentLine : WikiLine
    {
        #region 属性

        private int _Level;
        /// <summary>
        /// 缩进空白数（一个tab计算为一个空白）
        /// </summary>
        /// <value>The level.</value>
        public int Level
        {
            get { return _Level; }
        }


        private string _Content;
        /// <summary>
        /// 去掉前导空白后的内容
        /// </summary>
        /// <value>The content.</value>
        public string Content
        {
            get { return _Content; }
        }

        #endregion

        /// <summary>
        /// 初始化 <see cref="IndentLine"/> 类的新实例.
        /// </summary>
        /// <param name="line"></param>
        /// <param name="level"></param>
        /// <param name="content"></param>
        public IndentLine(string line, int level, string content) : base(LineType.Indent, line)
        {
            ResetAs(line, level, content);
        }

        /// <summary>
        /// Resets as.
        /// </summary>
        /// <param name="line">The line.</param>
        /// <param name="level">The level.</param>
        /// <param name="content">The content.</param>
        /// <returns></returns>
        public IndentLine ResetAs(string line, int level, string content)
        {
            if (line == null) throw new ArgumentNullException("line");
            if (content == null) throw new ArgumentNullException("content");
            if (level <= 0)
            {
                throw new ArgumentOutOfRangeException("level", level, "level 必须大于 0");
            }

            Line = line;
            _Level = level;
            _Content = content;

            return this;
        }
    }
}
